/**
 * 
 */
package com.roc.util.constant;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Administrator
 * 
 */
public enum DateFormat {
	ZH_CN_ALL("yyyy年MM月dd日 HH时mm分ss秒"),
	ZH_CN_WEEK("yyyy年MM月dd日 EEE"),
	ZH_CN_DATE("yyyy年MM月dd日"),
	ZH_CN_TIME("HH时mm分ss秒"),
	ZH_DEL_WEEK("yyyy-MM-dd EEE"),
	ZH_DEL_ALL("yyyy-MM-dd HH:mm:ss"),
	ZH_DEL_DATE("yyyy-MM-dd"),
	ZH_DEL_TIME("HH:mm:ss");
	private final String format;
	private final SimpleDateFormat sdf;

	private DateFormat(String format) {
		this.format = format;
		this.sdf = new SimpleDateFormat(format);
	}

	public String getFormat() {
		return format;
	}


	public SimpleDateFormat getSdf() {
		return sdf;
	}


	public String toString(Date date) {
		return sdf.format(date);
	}

	public Date toDate(String date) throws ParseException {
		return sdf.parse(date);
	}
}
